import React from 'react'
import {Button, Tooltip} from 'antd'


export class ToggleLabel extends React.Component {
    constructor (props) {
        super(props)

        this.toggle = this.toggle.bind(this)
        this.state = {
            tooltipOpen: false,
        }
    }

    toggle () {
        this.setState({
            tooltipOpen: !this.state.modal,
        })
    }


    render () {
        const {id, tooltip, buttonIcon,buttonName, ...attributes} = this.props
        return (
            <div>
                <div color="light" {...attributes}>{buttonName}<i id={id} className={buttonIcon} ></i></div>
                <Tooltip placement="bottom" target={id} isOpen={this.state.modal} toggle={this.toggle}>
                    {tooltip}
                </Tooltip>
            </div>
        )
    }
}
